<?php

class LVCApplication extends CWebApplication {

    public function init() {
        parent::init();
        $this->_loadConfig();
    }

    public function _loadConfig() {
        $params = $this->getParams();
        $cacheKey = '_config';
        $configs = Lvc::getCacheData('config', '_system_config', 'name, `value`');
        if ($configs) {
            foreach ($configs as $config)
                $params[$config->name] = $config->value;
        }
        // Build site metadata if has config
        $htmlMetadata = isset($params->htmlMetadata) ? $params->htmlMetadata : array();
        if (isset($params->metaTitle))
            $htmlMetadata['title'] = $params->metaTitle;
        if (isset($params->metaDescription))
            $htmlMetadata['description'] = $params->metaDescription;
        if (isset($params->metaKeywords))
            $htmlMetadata['keywords'] = $params->metaKeywords;
        $params->htmlMetadata = $htmlMetadata;
    }

}

?>